using GroupSix.Domain.Entity;

namespace GroupSix.Domain.Entity.App;

/// <summary>
/// 文章分类实体
/// </summary>
public class GsArticleCategory : EntityBase
{
    /// <summary>
    /// 分类名称
    /// </summary>
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 分类描述
    /// </summary>
    public string Description { get; set; } = string.Empty;

    /// <summary>
    /// 父级分类ID（支持多级分类）
    /// </summary>
    public Guid? ParentId { get; set; }

    /// <summary>
    /// 层级
    /// </summary>
    public int Level { get; set; } = 1;

    /// <summary>
    /// 排序权重
    /// </summary>
    public int SortOrder { get; set; } = 0;

    /// <summary>
    /// 构造函数
    /// </summary>
    public GsArticleCategory(string name, string description = "", Guid? parentId = null, int level = 1, int sortOrder = 0)
    {
        Name = name;
        Description = description;
        ParentId = parentId;
        Level = level;
        SortOrder = sortOrder;
    }

    /// <summary>
    /// 更新分类信息
    /// </summary>
    public void UpdateInfo(string name, string description, Guid? parentId, int level, int sortOrder)
    {
        Name = name;
        Description = description;
        ParentId = parentId;
        Level = level;
        SortOrder = sortOrder;
        UpdatedAt = DateTime.UtcNow;
    }
} 